#ifndef LIVEVIEWER_H
#define LIVEVIEWER_H

#include <QtGui/QWidget>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QPushButton>
#include <QSlider>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <vector>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <iplqimage.h>
#include "nodeconfig.h"
#include "liveclient.h"
#include "cp_pfcapture.h"
#include "pfnode.h"

class LiveViewer : public QWidget
{
    Q_OBJECT

public:
    LiveViewer(QWidget *parent = 0);
    ~LiveViewer();

public slots:
    void onConnectNodeClicked();
    void onViewNodeClicked();
    void onAllImageDataReceived();

signals:
    void connectButtonClicked();

private:
    /*Layout Begin*/
    QVBoxLayout *mainVLayout;
    QHBoxLayout *toolboxHLayout;
    QGridLayout *viewGLayout;
    /*Layout End*/

    /*Window Control Begin*/
    QPushButton *buttonRefreshNodeList;
    QPushButton *buttonConnectNode;
    QPushButton *buttonLiveView;
    QTreeWidget *treeNodeList;
    CP_PFCapture *cpPFSettings;
    QGraphicsView *camView;
    QGraphicsScene *camScene;
    QSlider *sliderZoom;
    QGraphicsView *thumbView;
    QGraphicsScene *thumbScene;
    /*Window Control End*/

    std::vector<PFNode *> pfNodes;
    std::vector<IplQImage *> cams;

    LiveClient *client;

    /*Window Initialization Begin*/
    void initWindow();
    void initScene();
    void initThumbScene();
    void initPFNodes();
    /*Window Initialization End*/
};

#endif // LIVEVIEWER_H
